#include "andconstraint.h"

AndConstraint::AndConstraint(
    boost::shared_ptr<Constraint> lconstraint,
    boost::shared_ptr<Constraint> rconstraint)
	: lconstraint_(lconstraint),
	  rconstraint_(rconstraint)
{
}

AndConstraint::~AndConstraint()
{
}

/// Tests a schedule object to see if it fulfills both of the two alternative
/// constraints.
/// \param schedule The schedule object against which the constraint is tested.
/// \return True if the schedule fulfills the constraint, false otherwise.
bool AndConstraint::consider(const Schedule& schedule)
{
	return lconstraint_->consider(schedule) && rconstraint_->consider(schedule);
}

std::string AndConstraint::to_string()
{
    return lconstraint_->to_string() + " AND " + rconstraint_->to_string();
}
